package com.elitesland.org.repo;

import com.elitesland.org.entity.OrgPostDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface OrgPostRepo extends JpaRepository<OrgPostDO, Long>, QuerydslPredicateExecutor<OrgPostDO> {

    Optional<OrgPostDO> findByPostCode(String code);

    Optional<OrgPostDO> findByIdNotAndPostCode(Long id, String code);

    List<OrgPostDO> findAllByIdIn(List<Long> ids);

    List<OrgPostDO> findAllByOrderByPostName();

    void deleteAllByIdIn(List<Long> ids);
}
